using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SpawnController : MonoBehaviour
{
    public GameObject barrierFab;
    private PlayerController playerController;
    // Start is called before the first frame update
    void Start()
    {
        InvokeRepeating("Spawn", 4f, 4f);
        playerController = GameObject.Find("Player").GetComponent<PlayerController>();
    }

    // Update is called once per frame
    void Update()
    {
        
        if (playerController.stop)
        {
            CancelInvoke("Spawn");
        }

    }
    void Spawn()
    {
        Instantiate(barrierFab, transform.position, transform.rotation);
    }
}
